<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/jquery-3.3.1.js"></script>
</head>
<body>
    <div>111</div>
    <span>222</span>
    <div>
        <span myid="1">111</span><br>
        <span myid="2">111</span><br>
        <span myid="3">111</span><br>
        <span myid="4">111</span><br>
    </div>
    <script>
        $("div,span").css("color","red");
        $("div span").click(function (){
            this.innerHTML = this.getAttribute("myid");
        });
    </script>
</body>
</html>